home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / pas_all.zip / TI188.ASC < prev    next >
Text File  |  1991-09-11  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.   PRODUCT : TURBO PASCAL                               NUMBER : 188
  10.   VERSION : 3.02A
  11.        OS : PC-DOS, MS-DOS
  12.      DATE : October 9, 1986                              PAGE : 1/2
  13.     TITLE : ADVANCED FILE HANDLINGT
  14.  
  15.  
  16.  
  17.  
  18.   The following information is presented for advanced users of
  19.   Turbo Pascal using MS-DOS or PC-DOS operating systems.
  20.  
  21.   Turbo Pascal uses MS-DOS file handles to open files. Function
  22.   call 3DH is used. One of the parameters to this call is the "open
  23.   mode," which provides DOS with information about the way you
  24.   intend to access the file and what access to allow other
  25.   processes (in a networking or future multitasking environment).
  26.  
  27.   Turbo Pascal normally uses an open mode byte of 2, which
  28.   designates Compatibility Mode with Read/Write Access and
  29.   Inheritance by child processes. By changing the value of this
  30.   byte to 0, you may open Read-only files. There may be other
  31.   applications for this, especially in a network environment.
  32.  
  33.   Open mode byte for Reset & Rewrite (PC-DOS):
  34.  
  35.    TURBO.COM CSEG:$24C6
  36.    TURBO-87.COM CSEG:$1F75
  37.    TURBOBCD.COM CSEG:$23CE
  38.  
  39.   Open mode byte for Reset & Rewrite (MS-DOS):
  40.  
  41.    TURBO.COM CSEG:$21EE
  42.    TURBO-87.COM CSEG:$1C9D
  43.    TURBOBCD.COM CSEG:$20F6
  44.  
  45.   The best way to use this information is to create an absolute
  46.   variable pointing to the byte, for example:
  47.  
  48.    var OpenModeByte: byte absolute CSeg:$24C6; (TURBO.COM PC-DOS)
  49.  
  50.   For additional safety, make sure that the value of the byte being
  51.   changed is actually 2 before changing it. Remember, change it
  52.   back to 2 if you intend to do normal file opening intermixed with
  53.   opening of Read-only or shared files. Information on the
  54.   different attributes can be found in the DOS 3.0 Technical
  55.   Reference Manual.
  56.  
  57.   { Using TURBO.COM version 3.02 }
  58.  
  59.   var OpenModeByte: byte absolute CSeg:$24C6;  (TURBO.COM PC-DOS)
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.   PRODUCT : TURBO PASCAL                               NUMBER : 188
  76.   VERSION : 3.02A
  77.        OS : PC-DOS, MS-DOS
  78.      DATE : October 9, 1986                              PAGE : 2/2
  79.     TITLE : ADVANCED FILE HANDLING
  80.  
  81.  
  82.  
  83.  
  84.   Procedure AccessReadOnly;
  85.  
  86.   begin
  87.     if not(OpenModeByte in [0, 2]) then
  88.       Error
  89.     else
  90.       OpenModeByte := 0;
  91.   end;
  92.  
  93.   procedure AccessReadWrite;
  94.  
  95.   begin
  96.     if not(OpenModeByte in [0, 2]) then
  97.       Error
  98.     else
  99.       OpenModeByte := 2;
  100.   end;
  101.  
  102.   The open mode byte for overlay, chain, and execute files is
  103.   normally 0, Compatibility Mode with Read Access. The addresses
  104.   for these mode bytes can be found by searching the run-time
  105.   library for the bytes 00 3D. The first occurrence is the one used
  106.   for overlay files, and the second is used for Chain and Execute
  107.   files.
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.